import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../common/colors.dart';
class TopDialogPage extends StatefulWidget {

  int selectIndex;

  TopDialogPage(this.selectIndex);


  @override
  State<TopDialogPage> createState() => _TopDialogPageState();
}

class _TopDialogPageState extends State<TopDialogPage> {

  var listArr = ['我的日报','评论我的','回复我的'];
  var typeArr = ['我的日报','comment','reply'];
  // int selectIndex = 0;

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: (){
        Get.back();
      },
      child: Container(
        margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top+kBottomNavigationBarHeight+35),
        child: Material(
          // height: 100,
          color: Colors.black45,
          child: Stack(
            children:[
              Container(
                height: 120,
                width: Get.width,
                color: Colors.white,
                child: ListView.builder(itemBuilder: (BuildContext context, int index) {
                  return GestureDetector(
                    behavior: HitTestBehavior.opaque,
                    onTap: (){
                      var params = {
                        'text':listArr[index],
                        'isShow':false,
                        'reply_type':typeArr[index]
                      };
                      Get.back(result:params);
                    },
                    child: Column(
                      children: [
                        Container(
                          padding: EdgeInsets.only(left: 15,right: 15),
                          alignment: Alignment.centerLeft,
                          height: 40,
                          // color: Colors.yellow,
                          child: Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Text('${listArr[index]}',style: TextStyle(fontSize: 13,
                                  color:widget.selectIndex==index?AppColor.themeColor:AppColor.textColor
                              ),),
                              Icon(Icons.check,size: 15,color: widget.selectIndex==index?AppColor.themeColor:
                                Colors.transparent,),
                            ],
                          ),
                        ),
                        Container(
                          height: 0.5,
                          color: AppColor.lineColor,
                        )
                      ],
                    ),
                  );
                },itemCount: listArr.length,),
              )
            ] ,
          ),
        ),
      ),
    );
  }
}
